package common.element;

import com.alibaba.fastjson.JSON;
import lombok.Getter;
import lombok.Setter;

import java.math.BigDecimal;
import java.math.BigInteger;
import java.util.Date;

public abstract class Column
{
    @Setter
    @Getter
    private ColumnType columnType;

    @Setter
    @Getter
    private Object object;

    @Setter
    @Getter
    private int byteSize;

    public Column(final Object object, final ColumnType columnType, int byteSize)
    {
        this.object = object;
        this.columnType = columnType;
        this.byteSize = byteSize;
    }

    public abstract Boolean asBoolean();

    //
    public abstract Long asLong();

    public abstract Double asDouble();

    public abstract BigDecimal asBigDecimal();

    public abstract BigInteger asBigInteger();

    //
    public abstract String asString();

    public abstract Date asDate();

    public abstract byte[] asBytes();


    @Override
    public String toString()
    {
        return JSON.toJSONString(this);
    }

}
